/* Nicholas Lineback and Jeremy Cowan
   COSC 530 Computer Architecture
   Project 1
   Cache Simulator
   2011-10-20
*/

#include "init.h"
#include "hierarchy.h"
#include "cache.h"
using namespace std;

int main(int argc, char* argv[])
{
  std::vector<mem_instruction> inst_list;
  
  // get command line args
  parseArgs(argc, argv);
  
  // parse instruction file
  try
  {
    parseFile(inst_list);
  }
  catch (fileParseException e)
  {
    exit(1);
  }

  // create memory Hierarchy
  hierarchy theHierarchy;
  
  
  for(int i = 0; i < inst_list.size(); i++)
  {
    theHierarchy.updateLRU();
    theHierarchy.load_store(inst_list[i]);
  }
  
  theHierarchy.printData();
  cout << "AMAT = " << theHierarchy.calc_AMAT() << endl;
  
  inst_list.clear();
  return 0;
}
